﻿<%@ Page Title="现有品质估算" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="QualityEstimatesList.aspx.cs" Inherits="StoragePeriod.Web.StorageForecast.QualityEstimates.QualityEstimatesList" %>
<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
    .layout{background:url(/images/images_25.jpg) no-repeat; }
    .center_table{height:30px;}
    .center_table table thead tr td{ background:url(/images/images_44.jpg) repeat-x;}
    .center_btnlist{ border-bottom:1px solid #ccc;}
    .Right_title120{background-position:0px 0px;}
    .Right_title_0{width:715px; height:23px; margin:0px auto;margin-top:10px;  background:url(/images/images_47.jpg) repeat-x;}
    .Right_title120 li{width:99px;height:23px; background:url(/images/images_46.jpg) no-repeat;}
    #li_selected{color:#f90;}
    #MainContent_IntroContent{text-align:left; width:693px; height:130px; padding:10px; margin-top:-20px; overflow:auto;}
    .ImgInfo{width:549px; height:246px; padding:15px; background:url(/images/images_63.jpg) no-repeat;}
    .ImgContent td{padding-top:5px;}
    .list_Prve{ width:18px; height:70px; background:url(/images/images_68.jpg) no-repeat; border:0px; cursor:pointer;}
    .list_Prve:hover{background:url(/images/images_72.jpg) no-repeat;}
    .list_Next{ width:18px; height:70px; background:url(/images/images_71.jpg) no-repeat; border:0px; cursor:pointer;}
    .list_Next:hover{background:url(/images/images_69.jpg) no-repeat;}
    #ImglistMain{width:100%;}
    #ImglistMain li{width:94px; height:64px; display:block; float:left; margin-left:10px; padding:8px 4px 4px 4px; background:url(/images/images_67.jpg) no-repeat; cursor:pointer;}
    /*.Imglist li:hover{background:url(/images/images_66.jpg) no-repeat;}*/
    .imgEdit td{padding-top:5px;}
    .Center_Title{width:100%; height:25px; line-height:25px; padding-top:15px;padding-bottom:5px; }
    .Center_Title h2{ font-size:14px; color:#f90; font-weight:600; height:25px; line-height:25px; width:100%; text-align:left; text-indent:1em;border-top:1px solid #ccc;border-bottom:1px solid #ccc;}
    /*适应高页面样式*/
    .main{ height:790px;}
    .right-cloumn{ height:750px;}
    .layout{ background-image:url(/images/images_25_2.jpg);}
    </style>
    <%--<script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>--%>

    <script src="/Scripts/artDialog/artDialog.source.js?skin=default" type="text/javascript"></script>
    <script src="/Scripts/artDialog/plugins/iframeTools.source.js" type="text/javascript"></script>
    <script type="text/javascript">
        //设置品质估算模型
        function SetCalculate() {
            var b = IsVerification();
            if (b) {
                var RawID = $("#MainContent_HidRawID").val();
                var QuotaID = $("#MainContent_Drop_TargetsInfo").val();
                art.dialog.open('/StorageForecast/QualityEstimates/TheFormulaEdit.aspx?RawID=' + RawID + "&QuotaID=" + QuotaID + "&Rid="+Math.random(), { title: '品质估算模型' });
            }
        }

        //验证
        function IsVerification() {
            var b = true;
            if ($("#MainContent_HidRawID").val() == "") {
                alert("请选择原料！");
                return false;
            }
            if ($("#MainContent_Drop_TargetsInfo").val() == "" || $("#MainContent_Drop_TargetsInfo").val() == null) {
                alert("请选择二级指标！");
                return false
            }
            return b;
        }

        //品质估算验证
        function IsVCalulate() {
            var b = true;
            if ($("#MainContent_HidRawID").val() == "") {
                alert("请选择原料！");
                return false;
            }
            if ($("#MainContent_txt_Temperature").val() == "") {
                alert("请输入温度！");
                return false;
            }
            if ($("#MainContent_txt_licunTime").val() == "") {
                alert("请输入库存时间！");
                return false;
            }
            return b;
        }

    </script>

    <script type="text/javascript">
        $(document).ready(function () {
            var dlg_temp;
            if ($.browser.version <= 7) {
                dlg_temp = $("#dialog-form-temp").dialog({
                    autoOpen: false,
                    modal: true,
                    width: $("#dialog-form-temp").width() + "px",
                    buttons: {
                        提交: function () {
                            var container = $("#dialog-form-temp iframe").first().contents();
                            if (container.length == 0)
                                container = $("#dialog-form-temp");

                            container.find("input[type=submit]").get(0).click();
                            //$(".ui-dialog-buttonset button:last").click();
                        },
                        取消: function () {
                            if (sp.page.backvalue != '-1') {
                                location.href = location.href.split('?')[0] + "?backvalue=" + sp.page.backvalue;
                            }
                            $(this).dialog("close");
                        }
                    },
                    close: function () { }
                });
            }
            else {
                dlg_temp = $("#dialog-form-temp").dialog({
                    autoOpen: false,
                    height: 'auto',
                    width: 'auto',
                    modal: true,
                    buttons: {
                        提交: function () {
                            var container = $("#dialog-form-temp iframe").first().contents();
                            if (container.length == 0)
                                container = $("#dialog-form-temp");
                            container.find("input[type=submit]").get(0).click();
                        },
                        取消: function () {
                            if (sp.page.backvalue != '-1') {
                                location.href = location.href.split('?')[0] + "?backvalue=" + sp.page.backvalue;
                            }
                            $(this).dialog("close");
                        }
                    },
                    close: function () { }
                });
            }
            dlg_temp.parent().appendTo("#dialog_target");
        });

        //默认选择第一个
        function SetShowPage() {
            $(document).ready(function () {
                var showid = $("#MainContent_HidPageId").val();
                $("#Right_title li[showid='" + showid + "']").trigger("click");

                if ($("#ImglistMain li").length > 0) {
                    if ($("#MainContent_HidIsNext").val() == "1") {
                        $("#ImglistMain li:first").trigger("click");
                    }
                    else {
                        $("#ImglistMain li:last").trigger("click");
                    }
                }
            });
        }

        function SaveImgV() {
            var b = true;
            if ($("#MainContent_txt_addImgName").val() == "") {
                alert("请输入图片名称!");
                b = false;
            }

            if ($("#MainContent_file_ImgPath").val() == "") {
                alert("请选择图片!");
                b = false;
            }
            else {
                var strName = $("#MainContent_file_ImgPath").val().toString().split('.');
                var mex = strName[strName.length - 1];
                if (mex != 'jpg' && mex != 'gif' && mex != 'png') {
                    alert("请选择正确的图片格式");
                    b = false;
                }
            }
            return b;
        }

        function PagePrveV() {
            var b = true;
            var pageindex = parseInt($("#MainContent_HidPageIndex").val());
            var pagecount = parseInt($("#MainContent_HidPageCount").val());
            if (pageindex == 1) {
                alert("已经移动到首页!");
                b = false;
            }
            return b;
        }

        function PageNextV() {
            var b = true;
            var pageindex = parseInt($("#MainContent_HidPageIndex").val());
            var pagecount = parseInt($("#MainContent_HidPageCount").val());
            if (pageindex == pagecount) {
                alert("已经移动到最后一页!");
                b = false;
            }
            return b;
        }

        //上一张图片
        function ImgPrev() {
            $("#MainContent_HidIsNext").val("0"); //控制显示第一张 还是最后一张
            var ImgID = $("#MainContent_HidImgID").val();
            if (ImgID == $("#ImglistMain li:first").attr("ImgID")) {
                $("#MainContent_Btn_List_Prve").trigger("click");
            }
            else {
                $("#ImglistMain li[ImgID='" + ImgID + "']").prev().trigger("click");
            }
        }

        //下一张图片
        function ImgNext() {
            $("#MainContent_HidIsNext").val("1");
            var ImgID = $("#MainContent_HidImgID").val();

            if (ImgID == $("#ImglistMain li:last").attr("ImgID")) {
                $("#MainContent_Btn_List_Next").trigger("click");
            }
            else {
                $("#ImglistMain li[ImgID='" + ImgID + "']").next().trigger("click");
            }
        }

        $(document).ready(function () {
            $("#ImglistMain li").live("click", function () {
                $("#ImglistMain li").css("background-image", "url(/images/images_67.jpg)");
                $(this).css("background-image", "url(/images/images_66.jpg)");

                $("#MainContent_HidImgID").val($(this).attr("ImgID"));
                $("#ImgView").attr("src", $(this).attr("ImgPath"));
                $("#MainContent_txt_ImgName").val($(this).attr("Imgname"));
                $("#MainContent_txt_UploadUserName").val($(this).attr("UpLoadUserName"));
                $("#MainContent_txt_UploadTime").val($(this).attr("UploadTime"));
                $("#MainContent_txt_Description").val($(this).attr("Description"));
            });
        });
    </script>

    <script type="text/javascript">
       
        function SetTxt(P_SumCount, P_X, P_K_1, P_K_2, P_K_3, P_K_4) {
            $("#MainContent_txt_P_SumCount").val(P_SumCount);
            $("#MainContent_txt_P_X").val(P_X);

            $("#MainContent_txt_P_K_1").val(P_K_1);
            $("#MainContent_txt_P_K_2").val(P_K_2);
            $("#MainContent_txt_P_K_3").val(P_K_3);
            $("#MainContent_txt_P_K_4").val(P_K_4);
        }

        function Showdlg() {
            $("#dialog-form").dialog('open');
        }
        function ShowdlgTemp() {
            $("#dialog-form-temp").dialog('open');
            return false;
        }

        function ShowNav(showid) {
            $(".Right_title120 li[showid='" + showid + "']").trigger("click");
        }
    </script>
</asp:Content>
 
  <asp:Content ID="BodyContentLeft" ContentPlaceHolderID="MainLeft"  runat="server">
            <h2><asp:Label ID="Left_Title" runat="server" Text="现有品质估算"></asp:Label></h2>
            <div class="Left_Main">
                <h3>原料列表</h3>
                <div class="Left_Rawlist" style="height: 360px;">
                    <asp:TreeView ShowLines="True" ID="NutrientsTree" Style="max-height: 320px; text-align: left;"
                        runat="server" OnSelectedNodeChanged="SysTree_SelectedNodeChanged">
                        <SelectedNodeStyle Font-Bold="True" BackColor="#0072BB" ForeColor="#ffffff" />
                    </asp:TreeView>
                </div>
                <div class="Left_Search" style="height: 60px;">
                    <ul>
                        <li><asp:TextBox style="width: 106px;" ID="Txt_Search" runat="server"></asp:TextBox></li>
                        <li><asp:Button ID="btn_search" class="btn_search" runat="server" Text="" onclick="btn_search_Click" /></li>
                    </ul>
                    <div class="clearboth">
                    </div>
                    <ul style="margin-top:6px;">
                        <li style="width:70px"><input type="button" value="添 加" onclick="addNew()" class="rbtn_02" /></li>
                        <li><asp:Button ID="btn_Del" runat="server" Text="删 除" OnClientClick="return DeleOption()" OnClick="btn_Del_Click"  class="rbtn_02" /></li>
                    </ul>
                    <div class="clearboth">
                    </div>
                </div>
            </div>
</asp:Content>

<asp:Content ID="BodyContentRight" ContentPlaceHolderID="MainContent" runat="server">
<div class="Right_title" id="Right_title" style="height:32px; background-position:0px 0px;">
    <ul>
        <li id="Right_title_li_0" showid="0">现有品质估算</li>
    </ul>
</div>

<div class="Right_center" style="height:710px;">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <asp:HiddenField ID="HidRawID" runat="server" Value="" />

    <asp:HiddenField ID="HidPageId" runat="server" Value="0" />
    <asp:HiddenField ID="HidPageIndex" runat="server" Value="1" />
    <asp:HiddenField ID="HidPageCount" runat="server" Value="1" />
    <asp:HiddenField ID="HidImgID" runat="server" Value="0" />
    <asp:HiddenField ID="HidIsNext" runat="server" Value="1" />
    <!--贮存期预测 Start-->
    <div id="center_0"> 
    <div class="center_Main displayblock">
        <div class="center_table">
            <table cellpadding="0" cellspacing="0" width="100%">
                <thead>
                    <tr>
                        <td width="200px;">
                            单位：
                            <asp:DropDownList ID="Drop_OperationSearch" runat="server" style="width:100px;" 
                            onselectedindexchanged="Drop_OperationSearch_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
                        </td>
                        <td align="left">
                            班组：
                            <asp:DropDownList ID="Drop_TeamSearch" runat="server" style="width:100px;"></asp:DropDownList>
                        </td>
                    </tr>
                </thead>
            </table>
        </div>
        <div class="center_btnlist">
            <ul>
               <li style="width:160px;"><asp:Label ID="lbl_SelRawName" runat="server" Text="已选原料："></asp:Label></li>
               <li style="width:60px;">控制指标：</li>
               <li style="margin-left:0px;width:85px;">
                   <asp:DropDownList ID="Drop_Targets" runat="server" onselectedindexchanged="Drop_Targets_SelectedIndexChanged" AutoPostBack="true">
                   </asp:DropDownList>
               </li> 
               <li style="width:60px;">二级指标：</li>
               <li style="margin-left:0px;">
                   <asp:DropDownList ID="Drop_TargetsInfo" runat="server" AutoPostBack="true"
                       onselectedindexchanged="Drop_TargetsInfo_SelectedIndexChanged">
                   </asp:DropDownList>
               </li>
               <asp:Panel ID="Pan_Vc" runat="server" Visible="false">
                <li>Vc含量:<asp:TextBox ID="txt_Vc" runat="server" CssClass="input" style="width:60px;"></asp:TextBox></li>
               </asp:Panel>
               <li style="float:right; margin-right:10px;"><input id="btnParameterSet" value="计算公式" class="btn_0" onclick="SetCalculate()" /></li>
            </ul>
            <div class="clearboth"></div>
        </div>

        <div class="center_btnlist">
            <ul>
               <li style="width:60px;">库存温度：</li>
               <li style="width:100px;margin-left:0px;"><asp:TextBox ID="txt_Temperature" runat="server" CssClass="input" style="width:60px;"></asp:TextBox>(℃)</li>
               <li style="width:60px;">存放时间：</li>
               <li style="margin-left:0px;width:85px;"><asp:TextBox ID="txt_licunTime" runat="server" CssClass="input" style="width:60px;"></asp:TextBox>(天)</li>
               <li style="width:60px; text-align:right;">参考值：</li>
               <li style="margin-left:0px;"><asp:TextBox ID="txt_ReferenceValue" runat="server" CssClass="input" Enabled="false"></asp:TextBox></li> 
               <li style="width:60px;">实际值：</li>
               <li style="margin-left:0px;"><asp:TextBox ID="TxT_FactValue" runat="server" CssClass="input" Enabled="false"></asp:TextBox></li> 
               <li style="float:right; margin-right:10px;"><asp:Button ID="Btn_Calulate" runat="server" Text="品质估算" CssClass="btn_0" OnClientClick="return IsVCalulate()" OnClick="Btn_Calulate_Click" /></li>
            </ul>
            <div class="clearboth"></div>
        </div>

        <div style="width:100%;padding-top:10px;">
            <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tbody>
                    <tr>
                        <td width="85px" valign="top">现有品质：</td>
                        <td align="left"><asp:TextBox ID="txt_centent" runat="server" TextMode="MultiLine" style="width:650px; height:100px;"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td colspan="2" align="right" style="padding-top:10px;"><asp:Button ID="Btn_SaveCalulate" runat="server" Text="保存" CssClass="btn_0" onclick="Btn_SaveCalulate_Click" />&nbsp;&nbsp;&nbsp;</td>
                    </tr>
                </tbody>
            </table>
        </div>

    </div>
    <!--贮存期预测 End-->
    <div class="Center_Title">
        <h2>品质变化图</h2>
    </div>
    
    <!--图片预览 Start-->
    <div class="center_Main displayblock">
        <table border="0" cellpadding="0" cellspacing="0" style="width:90%; margin:0px auto;">
            <tbody>
                <tr>
                    <td valign="middle" align="center">
                        <div class="ImgInfoBtn">
                            <img id="Img_Prev" onclick="ImgPrev()" alt="上一张" src="/images/images_64.jpg" width="56" height="79" style="cursor:pointer;" />
                        </div>
                    </td>
                    <td style="width:579px;">
                        <div class="ImgInfo">
                            <img id="ImgView" alt="图片预览" src="/images/images_15.jpg" width="549" height="246" />
                        </div>
                    </td>
                    <td  valign="middle" align="center">
                        <div class="ImgInfoBtn">
                            <img id="Img_Next" onclick="ImgNext()" alt="下一张" src="/images/images_65.jpg" width="56" height="79" style="cursor:pointer;"/>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <table border="0" cellpadding="0" cellspacing="0" style="width:98%" class="ImgContent">
                            <tbody>
                                <tr>
                                    <td align="right" style="width:75px;">图片名称：</td>
                                    <td align="left"><asp:TextBox ID="txt_ImgName" runat="server" style="width:100%;"></asp:TextBox></td>
                                    <td align="right" style="width:75px;">上传人员：</td>
                                    <td align="left"><asp:TextBox ID="txt_UploadUserName" runat="server" style="width:100%;"></asp:TextBox></td>
                                    <td align="right" style="width:75px;">上传时间：</td>
                                    <td align="left"><asp:TextBox ID="txt_UploadTime" runat="server" style="width:100%;"></asp:TextBox></td>
                                </tr>
                                <tr>
                                    <td align="right">图片描述：</td>
                                    <td colspan="5" align="left"><asp:TextBox ID="txt_Description" runat="server" TextMode="MultiLine" style="width:100%;height:40px;"></asp:TextBox></td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                    <td></td>
                </tr>
            </tbody>
        </table>

        <table border="0" cellpadding="0" cellspacing="0" style="width:98%; margin:0px auto;" class="ImgList">
            <tbody>
                <tr>
                    <td align="center" style="width:100px;">
                        <asp:Button ID="Btn_AddImg" CssClass="btn_0" runat="server" OnClientClick="return ShowdlgTemp();" Text="添加" />
                    </td>
                    <td rowspan="2">
                        <table border="0" cellpadding="0" cellspacing="0" style="width:100%;">
                            <tbody>
                                <tr>
                                    <td align="center" style="width:20px;">
                                        <div class="ImgListBtn">
                                            <asp:Button ID="Btn_List_Prve" CssClass="list_Prve" runat="server" OnClientClick="return PagePrveV();" OnClick="Btn_List_Prve_Click" Text="" />
                                        </div>
                                    </td>
                                    <td style="width:560px;">
                                        <div>
                                            <ul id="ImglistMain">
                                                <asp:Repeater ID="RepImgList" runat="server">
                                                    <ItemTemplate>
                                                        <li ImgID="<%#Eval("id")%>" ImgPath="/UpLoad/<%#Eval("ImgPath")%>"  Imgname="<%#Eval("ImgName")%>" UploadTime="<%#Eval("UpLoadTime")%>" UpLoadUserName="<%#Eval("UpLoadUserName")%>" Description="<%#Eval("Description")%>">
                                                            <img alt="<%#Eval("ImgName")%>" src="/UpLoad/<%#Eval("ImgPath")%>" width="94" height="64" />
                                                        </li>
                                                    </ItemTemplate>
                                                </asp:Repeater>
                                            </ul>
                                        </div>
                                    </td>
                                    <td align="left" style="padding-left:10px;">
                                        <div class="ImgListBtn">
                                            <asp:Button ID="Btn_List_Next" CssClass="list_Next" runat="server" OnClientClick="return PageNextV();" OnClick="Btn_List_Next_Click" Text="" />
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td><asp:Button ID="Btn_DelImg" CssClass="btn_0" runat="server" OnClientClick="return confirm('确定删除?');" OnClick="Btn_DelImg_Click" Text="删除" /></td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <div class="ImglistBS">
                            <ul>
                                <li></li>
                            </ul>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <!--图片预览 End-->
    </div>
    </ContentTemplate>
    </asp:UpdatePanel>
</div>

<div class="Right_foot">
    <img src="/images/images_29.jpg" width="764" height="8"/>
</div>

<div class="sp-dialog-box" id="dialog-form-temp" title="添加图片" style="width:500px; display:none;">
    <div class="Vc_top imgEdit">
        <table border="0" cellpadding="0" cellspacing="0" style="width:450px;">
            <tr>
                <td align="right">图片名称：</td>
                <td align="left">
                   <asp:TextBox ID="txt_addImgName" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="right">选择图片：</td>
                <td align="left">
                    <asp:FileUpload ID="file_ImgPath" runat="server" />
                </td>
            </tr>
            <tr>
                <td align="right">图片描述：</td>
                <td>
                    <asp:TextBox ID="txt_addImgDescription" runat="server" TextMode="MultiLine" style="width:100%; height:60px;"></asp:TextBox>
                </td>
            </tr>
        </table>
    </div>
    <asp:Button Text="确定" runat="server" CssClass="die" ID="btn_SaveImg" OnClientClick="return SaveImgV();" OnClick="btn_SaveImg_Click" />
</div>
</asp:Content>